(()=>{"use strict";function e(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return!(!t||"open"!==e.review_status)&&(!!n||"1"===String(t.show_status)&&Number(e.review_count)>0)}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function n(e){for(var n=1;n({hostProps:n}),errorCaptured:e=>(d=e,s||r(e),!1),render(e){return e(u.default,{props:this.hostProps,on:{templateFailure:r}})}});try{if(a.$mount(c),d)throw d}catch(e){throw a.$destroy(),e}finally{s=!1}return a}!function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;t.shopSDK.register(["ui-extension-points"],(r=>{let{uiExtensionPoints:l}=r;l.defineExtComp(["ProductCommentCountUI"],(r=>{const l=t.document.createElement("div");let i,u;l.hidden=!0;let c=!1,d=!1;function s(){var e,t,n;d=!0,null===(e=u)||void 0===e||e.$destroy(),u=null,null===(t=i)||void 0===t||null===(n=t.destroy)||void 0===n||n.call(t),i=null}const a=e=>{d||(s(),l.hidden=!1,l.textContent="Unable to load product reviews.",t.document.dispatchEvent(new t.CustomEvent("module-template:error",{detail:{code:e.code||"TEMPLATE_APP_RENDER",reason:String(e.message).split("\n")[0],stage:"comment-render"}})))};function p(){var e,n,o;const l=(null===(e=r.provide)||void 0===e?void 0:e.props)||{},u=i?i.api.product.rawProduct:l.product||t.shopSDK.ui.product.getProductPageInfo().rawProduct;if(!Number.isSafeInteger(u.ID)||u.ID<1||void 0!==l.productId&&l.productId!==u.ID)throw new TypeError("Reviews must belong to the current product.");return{product:u,theme:i?t.store.state.theme_name||"":null!==(n=null!==(o=l.theme)&&void 0!==o?o:t.store.state.theme_name)&&void 0!==n?n:"",introStyle:!i&&!0===l.introStyle}}return{render(){if(c){if(u&&!d&&null==i)try{u.hostProps=n(n({},p()),{},{templateApp:null})}catch(e){a(e)}}else c=!0,async function(){var c,m,v,f,h;if(await new Promise((e=>t.runOnStartupAndDOMLoaded(e))),d)return;i=null===(c=r.provide)||void 0===c||null===(m=c.export)||void 0===m||null===(v=m.getTemplateContext)||void 0===v?void 0:v.call(m,"Comment");const w=p(),y=null===(f=i)||void 0===f?void 0:f.template;if(!(null==i||Object.prototype.hasOwnProperty.call(i,"template")&&(null===y||y&&"string"==typeof y.code)))throw new TypeError("Invalid comment template code.");const P=null!=i&&null!==y&&""!==y.code,b=null===(h=t.store.state.plugConfig)||void 0===h?void 0:h.Comment;if(!b||i&&!e(w.product,b,P))return void s();const g=await o(t,l,n(n({},w),{},{templateApp:P?i:null}),(()=>d),a);d?null==g||g.$destroy():(u=g,null==i&&(u.hostProps=n(n({},p()),{},{templateApp:null})),l.hidden=!1)}().catch(a);return l},destroyed(){s(),l.remove()}}}))}))}(window)})();